package com.example.sqlite.litepal;

import org.litepal.LitePal;

import java.util.List;

public class AddressDao {
    public int insert(Address address) {
        int newId = 0;
        if (address.save()) {
            newId = address.get_id();
        }
        return newId;
    }

    public boolean update(Address address) {
        return address.update(address.get_id()) > 0;
    }

    public boolean delete(int _id) {
        return LitePal.delete(Address.class, _id) > 0;
    }


    public List<Address> query() {
        return LitePal.findAll(Address.class);
    }
}
